home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1999 #1
/
Amiga Plus 1999 #1.iso
/
System-Boost
/
Workbench
/
BackClock
/
sources
/
partial.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-10
|
4KB
|
138 lines
/*****************************************************************************
*
* name : partial.c
* description : close & reopen window on workbench close
* version : 2.1ß2
*
* created : ?
* last change : 14-07-98
*
* version 2.1: bugfixed (sizing and dragging gadget)
* version 2.1ß2 : now open the window as backdrop
*****************************************************************************
*/
#include "utils.h"
#include "partial.h"
#include "obp.h"
#include <proto/intuition.h>
#include <proto/exec.h>
BOOL partialClose(idWin * prj) {
/*
* handle notify_intuition msg
* close the window
*
*/
BOOL ret = FALSE ;
struct Message * msg ;
struct IntNotifyMessage * imsg ;
msg = GetMsg(prj->notifyPort) ;
imsg = (struct IntNotifyMessage*)msg ;
if (imsg->inm_Code == 0x200) {
/* close the window
*/
if (prj->win) {
CloseWindow(prj->win) ;
prj->win = NULL ; // in case of error
ret = TRUE ;
}
}
if (msg) ReplyMsg(msg) ;
return(ret) ;
}
void partialOpen(idWin * prj) {
/* reopen the window
*/
struct Screen * WBScreen = NULL ;
struct Message * msg ;
struct IntNotifyMessage * imsg ;
UWORD code ;
ULONG mask ;
do{
/* get msg from notifyintuition
*/
mask = Wait(1<<(prj->notifyPort->mp_SigBit)) ;
if ((msg = GetMsg(prj->notifyPort)) != NULL) {
/* received a msg
*/
imsg = (struct IntNotifyMessage *)msg ;
code = imsg->inm_Code ;
ReplyMsg(msg) ;
}
}while(code != 0x100) ;
WBScreen = LockPubScreen("Workbench") ;
prj->wb = WBScreen ;
free_bitmap(prj) ;
init_bitmap(prj) ;
prj->win = OpenWindowTags(NULL, WA_Left, prj->backWin.posX,
WA_Top, prj->backWin.posY,
WA_Width, prj->backWin.width,
WA_Height, prj->backWin.height,
WA_IDCMP, IDCMP,
WA_MinWidth, 50,
WA_MinHeight, 50,
WA_MaxHeight, 200,
WA_MaxWidth, 200,
WA_Flags, WFLG,
WA_ScreenTitle, TXT_SCRTITLE,
WA_NewLookMenus, TRUE,
WA_PubScreenName, "Workbench", TAG_DONE) ;
RemoveGList(prj->win, &szgdg, 2) ;
szgdg.Width = prj->win->Width ;
szgdg.NextGadget = &tagdg ;
tagdg.LeftEdge = prj->win->Width - 10 ;
tagdg.TopEdge = prj->win->Height - 10 ;
AddGList(prj->win, &szgdg, 0, 2, NULL) ;
RefreshGList(&szgdg, prj->win, NULL, -1) ;
UnlockPubScreen(NULL, WBScreen) ;
setColors(prj) ;
}
void setWindow(idWin * prj) {
CloseWindow(prj->win) ;
prj->wb = LockPubScreen("Workbench") ;
free_bitmap(prj) ;
init_bitmap(prj) ;
prj->win = OpenWindowTags(NULL, WA_Left, prj->backWin.posX,
WA_Top, prj->backWin.posY,
WA_Width, prj->backWin.width,
WA_Height, prj->backWin.height,
WA_IDCMP, IDCMP,
WA_MinWidth, 50,
WA_MinHeight, 50,
WA_MaxHeight, MAXH,
WA_MaxWidth, MAXH,
WA_Flags, WFLG_BORDERLESS,
WA_ScreenTitle, "BackClock",
WA_NewLookMenus, TRUE,
WA_PubScreenName, "Workbench", TAG_DONE) ;
RemoveGList(prj->win, &szgdg, 2) ;
szgdg.Width = prj->win->Width ;
szgdg.NextGadget = &tagdg ;
tagdg.LeftEdge = prj->win->Width - 10 ;
tagdg.TopEdge = prj->win->Height - 10 ;
AddGList(prj->win, &szgdg, 0, 2, NULL) ;
RefreshGList(&szgdg, prj->win, NULL, -1) ;
UnlockPubScreen(NULL, prj->wb) ;
// ChangeWindowBox(prj->win, prj->backWin.posX, prj->backWin.posY, prj->backWin.width, prj->backWin.height) ;
reinit_win(prj) ;
}